<template>
    <section>

    </section>
</template>

<script>
    import {queryURLParams} from "@/assets/js/common";

    export default {
        name: "login_api",
        data(){
            return {

            }
        },
        mounted() {
            let url = (window.location.href).split('#')[0], code = this.$common.queryURLParams(url).code,_this = this
            this.$store.commit('login_token','')
            this.$store.commit('token','')
            if (code == null || code == undefined){
                window.location.href = '/web/#/login'
            }
            this.$https.fetchGet('/get_openid?code=' + code,{}).then( res => {
                debugger
                if(res.code == 2998){  ///获取code失败
                   window.location.href = '/web/#/login'
                }
                else if(res.code == 2999){
                    _this.$store.commit('token',res.data)

                    setTimeout((res) => {
                        window.location.href = '/web/#/bangding1'
                    },100)
                }
                else{
                    _this.$store.commit('token',res.data)
                    setTimeout((res) => {
                        window.location.href = '/web/#/index'
                    },100)
                }
            })
        }
    }
</script>

<style scoped>

</style>
